from clickhouse_driver import Client


def getClient():
    client = Client(host='http://dev.heidutech.cn', database='default', user='default', password='clickhouse092011',
                    send_receive_timeout=36000, port=37123)
    return client


if __name__ == '__main__':
    client = getClient()
    sql = (
            " select count() from (" +
            " select guid,EM,AF,RP,AU,C1,DE,SC,SO from Zhejiang_WOS.t_paper "
            " where guid not in (SELECT guid from Zhejiang_WOS.t_paper_OutPut_20231222) " +
            " and AF is not null and AF != '' " +
            " )"
    )
    sql_rows = client.execute(sql)
    count = sql_rows[0][0]
    print(count)
